<template lang="pug">
  ModuleWrapper(title="水果种植面积（万亩）" flex="1")
    .chart-wrap(ref="chart")
</template>

<script>
export default {
  name: "ModulePopulation",
  data() {
    return {
      chart: null,
      data: [
        {
          label: '总人口',
          value: 0,
        },
        {
          label: '农业人口',
          value: 0,
        },
        {
          label: '新型职业农民',
          value: 0,
        },
        {
          label: '产业工人',
          value: 0,
        },
      ]
    }
  },
  methods: {
    renderChart() {
      this.chart = this.$echarts.init(this.$refs['chart']);
      this.chart.setOption({
        xAxis: {
          type: 'category',
          data: ['2016', '2017', '2018', '2019','2020'],
          splitLine: false
        },
        yAxis: {
          type: 'value',
          splitLine: false
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          top: '15%',
          containLabel: true
        },
        series: [
          {
            data: [10.33, 10.7,10.6, 10.6,10.7],
            type: 'bar',
            barWidth: 20, //柱图宽度
			label:{
				show:true,
				position:"top",
				textStyle:{
					color:"#fff"
				}
			},
            itemStyle: {
              normal: {
                //颜色渐变
                color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                  offset: 0,
                  color: '#f79f56'
                }, {
                  offset: 1,
                  color: '#4b301a'
                }]),
                barBorderRadius: 5
              }
            }
          }
        ]
      });
    },
  },
  mounted() {
    this.$nextTick(() => {
      this.renderChart();
    });
  }
}
</script>

<style lang="scss" scoped>
.module{
  display: flex;
  flex-direction: column;
  
  .chart-wrap{
    flex: 1;
	
  }
}
</style>
